package top.superflow.version.db

import top.superflow.version.compare.suggestion.Suggestion
import top.superflow.version.db.compare.{CheckChildrenSuggestion, MetadataConsistencySuggestion, MetadataInconsistentHappened}

trait Version {

  def compare (targetStructure : Any): Option[Suggestion]

  def getMatchedChild (childDataVersionKey : Any) : Option[Version]
  
  def getId : String
  
  def summarizeSuggestion (suggestions : List[Suggestion]): Option[Suggestion] = {
    if(suggestions != null && suggestions.size != 0){
      val metadataIncompatibleSuggestion = new MetadataConsistencySuggestion(new MetadataInconsistentHappened(), new CheckChildrenSuggestion())
      metadataIncompatibleSuggestion.addSuggestion(suggestions)
      Some(metadataIncompatibleSuggestion)
    }else{
      None
    }
  }
}